package com.ruipengkj.component.jlist;

import java.awt.Component;

import javax.swing.DefaultListCellRenderer;
import javax.swing.JList;

public class ListButtonCellRenderer extends DefaultListCellRenderer {

	private static final long serialVersionUID = 1L;
	
	@Override
	public Component getListCellRendererComponent(JList list, Object aValue,
			int row, boolean isSelected, boolean cellHasFocus) {
		ListNodeButton button = (ListNodeButton)aValue;
		
		if (isSelected) {
			button.getModel().setSelected(true);
		} else {
			button.getModel().setSelected(false);
		}
		return button;
	}
	
	
}
